package com.codersatwork.repository;

import com.codersatwork.domain.Customer;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Saurabh Agrawal
 * @Created Mar 1, 2010
 */
@Repository
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public class CustomerRepository extends HibernateDaoSupport {

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    public Customer save(Customer customerToSave) {
        //@todo : Saurabh- find out the differece between save and merge
        return (Customer) getHibernateTemplate().merge(customerToSave);


    }
}
